package cn.itsy.dao.role;

import cn.itsy.pojo.SysRole;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author: MisterGay
 * @date: 2019-06-17 8:31
 */
@Repository(value = "sysRoleDaoImple")
public class SysRoleDaoImple implements SysRoleDao {
    @Resource(name = "jdbcTemplate")
    private JdbcTemplate jdbcTemplate;

    @Override
    public List<SysRole> querySysRoleAll(String sql) {
        List<SysRole> query = this.jdbcTemplate.query(sql, new BeanPropertyRowMapper<SysRole>(SysRole.class));
        return query;
    }

    @Override
    public void updateSysRoleName(String sql, String roleName, String oldRoleName) {
        this.jdbcTemplate.update(sql, roleName, oldRoleName);
    }
}
